Skip to content

new plugin: audio-stream#4216

Closed
dnecra wants to merge 43 commits intopear-devs:masterfrom
dnecra:master
Closed

new plugin: audio-stream#4216
dnecra wants to merge 43 commits intopear-devs:masterfrom
dnecra:master

Conversation

@dnecra
Copy link
Copy Markdown

@dnecra dnecra commented Dec 29, 2025

Audio Stream Plugin

Description

This plugin enables streaming of raw PCM (Pulse Code Modulation) audio data from Pear Desktop over HTTP. It allows external applications, recording software, or other devices on your local network to receive real-time audio streams for processing, recording, or playback.

How It Works

The plugin consists of three main components:

  1. Renderer Process: Captures audio from the Web Audio API using a ScriptProcessorNode, converts the audio samples to PCM format (16-bit or 32-bit), and sends the data to the backend via IPC.

  2. Backend Process: Runs an HTTP server that listens for client connections. When clients connect to the /stream endpoint, the server streams PCM audio data in real-time. The server maintains a small buffer of recent audio chunks so new clients can catch up.

  3. Configuration: Users can configure the streaming port, hostname, and audio quality settings (sample rate, bit depth, channels, buffer size) through the plugin menu.

Key Features

  • Real-time PCM streaming over HTTP
  • Configurable audio quality: Sample rates (44.1kHz, 48kHz, 96kHz), bit depths (16-bit, 32-bit), mono/stereo
  • Low latency: Configurable buffer sizes (1024-8192 samples) for balancing latency vs. stability
  • Multiple client support: Multiple applications can connect simultaneously
  • Dynamic configuration: Audio settings can be changed without restarting the app
  • CORS enabled: Allows connections from web-based applications

Use Cases

  • Recording audio from Pear Desktop to external software
  • Real-time audio processing and analysis
  • Streaming to external audio devices or applications
  • Integration with home automation or audio routing systems
  • Audio visualization or analysis tools

Technical Details

  • Default port: 8765
  • Default hostname: 0.0.0.0 (listens on all interfaces)
  • Default audio settings: 48kHz, 16-bit, stereo, 2048 sample buffer
  • Protocol: HTTP streaming with binary PCM data
  • Format: Each chunk includes metadata (sample rate, bit depth, channels, timestamp) followed by raw PCM samples

Configuration

The plugin can be configured through the Pear Desktop menu:

  • Port: Set the HTTP server port (default: 8765)
  • Quality & Latency: Adjust sample rate, bit depth, channels, and buffer size

Stream URL format: http://localhost:{port}/stream

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants